home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 March / macformat-022.iso / Shareware City / Developers / MW MPW Binaries 1.1.1a2 / mwcPPC / MWCIncludes / MIDI.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-01-31  |  11.2 KB  |  308 lines  |  [TEXT/MMCC]

  1. /*
  2.     File:        MIDI.h
  3.  
  4.     Copyright:    © 1984-1993 by Apple Computer, Inc., all rights reserved.
  5.  
  6.     WARNING
  7.     This file was auto generated by the interfacer tool. Modifications
  8.     must be made to the master file.
  9.  
  10. */
  11.  
  12. #ifndef __MIDI__
  13. #define __MIDI__
  14.  
  15. #ifndef __TYPES__
  16. #include <Types.h>
  17. /*    #include <ConditionalMacros.h>                                */
  18. /*    #include <MixedMode.h>                                        */
  19. /*        #include <Traps.h>                                        */
  20. #endif
  21.  
  22. #define midiToolNum 4
  23.  
  24. enum  {
  25.     midiMaxNameLen                = 31,                            /*maximum number of characters in port and client names*/
  26. /* Time formats */
  27.     midiFormatMSec                = 0,                            /*milliseconds*/
  28.     midiFormatBeats                = 1,                            /*beats*/
  29.     midiFormat24fpsBit            = 2,                            /*24 frames/sec.*/
  30.     midiFormat25fpsBit            = 3,                            /*25 frames/sec.*/
  31.     midiFormat30fpsDBit            = 4,                            /*30 frames/sec. drop-frame*/
  32.     midiFormat30fpsBit            = 5,                            /*30 frames/sec.*/
  33.     midiFormat24fpsQF            = 6,                            /*24 frames/sec. longInt format */
  34.     midiFormat25fpsQF            = 7,                            /*25 frames/sec. longInt format */
  35.     midiFormat30fpsDQF            = 8,                            /*30 frames/sec. drop-frame longInt format */
  36.     midiFormat30fpsQF            = 9,                            /*30 frames/sec. longInt format */
  37.     midiInternalSync            = 0,                            /*internal sync*/
  38.     midiExternalSync            = 1,                            /*external sync*/
  39. /* Port types*/
  40.     midiPortTypeTime            = 0,                            /*time port*/
  41.     midiPortTypeInput            = 1,                            /*input port*/
  42.     midiPortTypeOutput            = 2,                            /*output port*/
  43.     midiPortTypeTimeInv            = 3,                            /*invisible time port*/
  44. /* OffsetTimes  */
  45.     midiGetEverything            = 0x7FFFFFFF,                    /*get all packets, regardless of time stamps*/
  46.     midiGetNothing                = (long)0x80000000,                /*get no packets, regardless of time stamps*/
  47.     midiGetCurrent                = 0x00000000                    /*get current packets only*/
  48. };
  49.  
  50. enum  {
  51. /*    MIDI data and messages are passed in MIDIPacket records (see below).
  52.     The first byte of every MIDIPacket contains a set of flags
  53.    
  54.     bits 0-1    00 = new MIDIPacket, not continued
  55.                      01 = begining of continued MIDIPacket
  56.                      10 = end of continued MIDIPacket
  57.                     11 = continuation
  58.     bits 2-3     reserved
  59.   
  60.     bits 4-6      000 = packet contains MIDI data
  61.    
  62.                      001 = packet contains MIDI Manager message
  63.    
  64.     bit 7              0 = MIDIPacket has valid stamp
  65.                         1 = stamp with current clock */
  66.     midiContMask                = 0x03,
  67.     midiNoCont                    = 0x00,
  68.     midiStartCont                = 0x01,
  69.     midiMidCont                    = 0x03,
  70.     midiEndCont                    = 0x02,
  71.     midiTypeMask                = 0x70,
  72.     midiMsgType                    = 0x00,
  73.     midiMgrType                    = 0x10,
  74.     midiTimeStampMask            = 0x80,
  75.     midiTimeStampCurrent        = 0x80,
  76.     midiTimeStampValid            = 0x00,
  77. /*    MIDI Manager MIDIPacket command words (the first word in the data field
  78.     for midiMgrType messages) */
  79.     midiOverflowErr                = 0x0001,
  80.     midiSCCErr                    = 0x0002,
  81.     midiPacketErr                = 0x0003,
  82.     midiMaxErr                    = 0x00FF,                        /*all command words less than this value  are error indicators*/
  83. /* Valid results to be returned by readHooks */
  84.     midiKeepPacket                = 0,
  85.     midiMorePacket                = 1,
  86.     midiNoMorePacket            = 2,
  87. /* Errors: */
  88.     midiNoClientErr                = -250,                            /*no client with that ID found*/
  89.     midiNoPortErr                = -251                            /*no port with that ID found*/
  90. };
  91.  
  92. enum  {
  93.     midiTooManyPortsErr            = -252,                            /*too many ports already installed in the system*/
  94.     midiTooManyConsErr            = -253,                            /*too many connections made*/
  95.     midiVConnectErr                = -254,                            /*pending virtual connection created*/
  96.     midiVConnectMade            = -255,                            /*pending virtual connection resolved*/
  97.     midiVConnectRmvd            = -256,                            /*pending virtual connection removed*/
  98.     midiNoConErr                = -257,                            /*no connection exists between specified ports*/
  99.     midiWriteErr                = -258,                            /*MIDIWritePacket couldn't write to all connected ports*/
  100.     midiNameLenErr                = -259,                            /*name supplied is longer than 31 characters*/
  101.     midiDupIDErr                = -260,                            /*duplicate client ID*/
  102.     midiInvalidCmdErr            = -261,                            /*command not supported for port type*/
  103. /*     Driver calls: */
  104.     midiOpenDriver                = 1,
  105.     midiCloseDriver                = 2
  106. };
  107.  
  108. #if defined(powerc) || defined (__powerc)
  109. #pragma options align=mac68k
  110. #endif
  111. struct MIDIPacket {
  112.     unsigned char                flags;
  113.     unsigned char                len;
  114.     long                        tStamp;
  115.     unsigned char                data[249];
  116. };
  117. #if defined(powerc) || defined(__powerc)
  118. #pragma options align=reset
  119. #endif
  120.  
  121. typedef struct MIDIPacket MIDIPacket;
  122.  
  123. typedef MIDIPacket *MIDIPacketPtr;
  124.  
  125. #if defined(powerc) || defined (__powerc)
  126. #pragma options align=mac68k
  127. #endif
  128. struct MIDIClkInfo {
  129.     short                        sync;                            /*synchronization external/internal*/
  130.     long                        curTime;                        /*current value of port's clock*/
  131.     short                        format;                            /*time code format*/
  132. };
  133. #if defined(powerc) || defined(__powerc)
  134. #pragma options align=reset
  135. #endif
  136.  
  137. typedef struct MIDIClkInfo MIDIClkInfo;
  138.  
  139. #if defined(powerc) || defined (__powerc)
  140. #pragma options align=mac68k
  141. #endif
  142. struct MIDIIDRec {
  143.     OSType                        clientID;
  144.     OSType                        portID;
  145. };
  146. #if defined(powerc) || defined(__powerc)
  147. #pragma options align=reset
  148. #endif
  149.  
  150. typedef struct MIDIIDRec MIDIIDRec;
  151.  
  152. #if defined(powerc) || defined (__powerc)
  153. #pragma options align=mac68k
  154. #endif
  155. struct MIDIPortInfo {
  156.     short                        portType;                        /*type of port*/
  157.     MIDIIDRec                    timeBase;                        /*MIDIIDRec for time base*/
  158.     short                        numConnects;                    /*number of connections*/
  159.     MIDIIDRec                    cList[1];                        /*ARRAY [1..numConnects] of MIDIIDRec*/
  160. };
  161. #if defined(powerc) || defined(__powerc)
  162. #pragma options align=reset
  163. #endif
  164.  
  165. typedef struct MIDIPortInfo MIDIPortInfo;
  166.  
  167. typedef MIDIPortInfo *MIDIPortInfoPtr, **MIDIPortInfoHdl;
  168.  
  169. #if defined(powerc) || defined (__powerc)
  170. #pragma options align=mac68k
  171. #endif
  172. struct MIDIPortParams {
  173.     OSType                        portID;                            /*ID of port, unique within client*/
  174.     short                        portType;                        /*Type of port - input, output, time, etc.*/
  175.     short                        timeBase;                        /*refnum of time base, 0 if none*/
  176.     long                        offsetTime;                        /*offset for current time stamps*/
  177.     Ptr                            readHook;                        /*routine to call when input data is valid*/
  178.     long                        refCon;                            /*refcon for port (for client use)*/
  179.     MIDIClkInfo                    initClock;                        /*initial settings for a time base*/
  180.     Str255                        name;                            /*name of the port, This is a real live string, not a ptr.*/
  181. };
  182. #if defined(powerc) || defined(__powerc)
  183. #pragma options align=reset
  184. #endif
  185.  
  186. typedef struct MIDIPortParams MIDIPortParams;
  187.  
  188. typedef MIDIPortParams *MIDIPortParamsPtr;
  189.  
  190. #if defined(powerc) || defined (__powerc)
  191. #pragma options align=mac68k
  192. #endif
  193. struct MIDIIDList {
  194.     short                        numIDs;
  195.     OSType                        list[1];
  196. };
  197. #if defined(powerc) || defined(__powerc)
  198. #pragma options align=reset
  199. #endif
  200.  
  201. typedef struct MIDIIDList MIDIIDList;
  202.  
  203. typedef MIDIIDList *MIDIIDListPtr, **MIDIIDListHdl;
  204.  
  205. #ifdef __cplusplus
  206. extern "C" {
  207. #endif
  208.  
  209.  
  210. /* 
  211.     
  212.          Prototype Declarations for readHook and timeProc
  213.         
  214.          extern pascal short myReadHook(MIDIPacketPtr myPacket, long myRefCon);
  215.          extern pascal void myTimeProc(long curTime, long myRefCon);
  216.         
  217.          MIDI Manager Routines
  218. */
  219.  
  220. extern pascal NumVersion MIDIVersion(void)
  221.  FOURWORDINLINE(0x203C, 0x0000, 4, 0xA800);
  222. extern pascal OSErr MIDISignIn(OSType clientID, long refCon, Handle icon, ConstStr255Param name)
  223.  FOURWORDINLINE(0x203C, 0x0004, 4, 0xA800);
  224. extern pascal void MIDISignOut(OSType clientID)
  225.  FOURWORDINLINE(0x203C, 0x0008, 4, 0xA800);
  226. extern pascal MIDIIDListHdl MIDIGetClients(void)
  227.  FOURWORDINLINE(0x203C, 0x000C, 4, 0xA800);
  228. extern pascal void MIDIGetClientName(OSType clientID, Str255 name)
  229.  FOURWORDINLINE(0x203C, 0x0010, 4, 0xA800);
  230. extern pascal void MIDISetClientName(OSType clientID, ConstStr255Param name)
  231.  FOURWORDINLINE(0x203C, 0x0014, 4, 0xA800);
  232. extern pascal MIDIIDListHdl MIDIGetPorts(OSType clientID)
  233.  FOURWORDINLINE(0x203C, 0x0018, 4, 0xA800);
  234. extern pascal OSErr MIDIAddPort(OSType clientID, short BufSize, short *refnum, MIDIPortParamsPtr init)
  235.  FOURWORDINLINE(0x203C, 0x001C, 4, 0xA800);
  236. extern pascal MIDIPortInfoHdl MIDIGetPortInfo(OSType clientID, OSType portID)
  237.  FOURWORDINLINE(0x203C, 0x0020, 4, 0xA800);
  238. extern pascal OSErr MIDIConnectData(OSType srcClID, OSType srcPortID, OSType dstClID, OSType dstPortID)
  239.  FOURWORDINLINE(0x203C, 0x0024, 4, 0xA800);
  240. extern pascal OSErr MIDIUnConnectData(OSType srcClID, OSType srcPortID, OSType dstClID, OSType dstPortID)
  241.  FOURWORDINLINE(0x203C, 0x0028, 4, 0xA800);
  242. extern pascal OSErr MIDIConnectTime(OSType srcClID, OSType srcPortID, OSType dstClID, OSType dstPortID)
  243.  FOURWORDINLINE(0x203C, 0x002C, 4, 0xA800);
  244. extern pascal OSErr MIDIUnConnectTime(OSType srcClID, OSType srcPortID, OSType dstClID, OSType dstPortID)
  245.  FOURWORDINLINE(0x203C, 0x0030, 4, 0xA800);
  246. extern pascal void MIDIFlush(short refnum)
  247.  FOURWORDINLINE(0x203C, 0x0034, 4, 0xA800);
  248. extern pascal ProcPtr MIDIGetReadHook(short refnum)
  249.  FOURWORDINLINE(0x203C, 0x0038, 4, 0xA800);
  250. extern pascal void MIDISetReadHook(short refnum, ProcPtr hook)
  251.  FOURWORDINLINE(0x203C, 0x003C, 4, 0xA800);
  252. extern pascal void MIDIGetPortName(OSType clientID, OSType portID, Str255 name)
  253.  FOURWORDINLINE(0x203C, 0x0040, 4, 0xA800);
  254. extern pascal void MIDISetPortName(OSType clientID, OSType portID, ConstStr255Param name)
  255.  FOURWORDINLINE(0x203C, 0x0044, 4, 0xA800);
  256. extern pascal void MIDIWakeUp(short refnum, long time, long period, ProcPtr timeProc)
  257.  FOURWORDINLINE(0x203C, 0x0048, 4, 0xA800);
  258. extern pascal void MIDIRemovePort(short refnum)
  259.  FOURWORDINLINE(0x203C, 0x004C, 4, 0xA800);
  260. extern pascal short MIDIGetSync(short refnum)
  261.  FOURWORDINLINE(0x203C, 0x0050, 4, 0xA800);
  262. extern pascal void MIDISetSync(short refnum, short sync)
  263.  FOURWORDINLINE(0x203C, 0x0054, 4, 0xA800);
  264. extern pascal long MIDIGetCurTime(short refnum)
  265.  FOURWORDINLINE(0x203C, 0x0058, 4, 0xA800);
  266. extern pascal void MIDISetCurTime(short refnum, long time)
  267.  FOURWORDINLINE(0x203C, 0x005C, 4, 0xA800);
  268. extern pascal void MIDIStartTime(short refnum)
  269.  FOURWORDINLINE(0x203C, 0x0060, 4, 0xA800);
  270. extern pascal void MIDIStopTime(short refnum)
  271.  FOURWORDINLINE(0x203C, 0x0064, 4, 0xA800);
  272. extern pascal void MIDIPoll(short refnum, long offsetTime)
  273.  FOURWORDINLINE(0x203C, 0x0068, 4, 0xA800);
  274. extern pascal OSErr MIDIWritePacket(short refnum, MIDIPacketPtr packet)
  275.  FOURWORDINLINE(0x203C, 0x006C, 4, 0xA800);
  276. extern pascal Boolean MIDIWorldChanged(OSType clientID)
  277.  FOURWORDINLINE(0x203C, 0x0070, 4, 0xA800);
  278. extern pascal long MIDIGetOffsetTime(short refnum)
  279.  FOURWORDINLINE(0x203C, 0x0074, 4, 0xA800);
  280. extern pascal void MIDISetOffsetTime(short refnum, long offsetTime)
  281.  FOURWORDINLINE(0x203C, 0x0078, 4, 0xA800);
  282. extern pascal long MIDIConvertTime(short srcFormat, short dstFormat, long time)
  283.  FOURWORDINLINE(0x203C, 0x007C, 4, 0xA800);
  284. extern pascal long MIDIGetRefCon(short refnum)
  285.  FOURWORDINLINE(0x203C, 0x0080, 4, 0xA800);
  286. extern pascal void MIDISetRefCon(short refnum, long refCon)
  287.  FOURWORDINLINE(0x203C, 0x0084, 4, 0xA800);
  288. extern pascal long MIDIGetClRefCon(OSType clientID)
  289.  FOURWORDINLINE(0x203C, 0x0088, 4, 0xA800);
  290. extern pascal void MIDISetClRefCon(OSType clientID, long refCon)
  291.  FOURWORDINLINE(0x203C, 0x008C, 4, 0xA800);
  292. extern pascal short MIDIGetTCFormat(short refnum)
  293.  FOURWORDINLINE(0x203C, 0x0090, 4, 0xA800);
  294. extern pascal void MIDISetTCFormat(short refnum, short format)
  295.  FOURWORDINLINE(0x203C, 0x0094, 4, 0xA800);
  296. extern pascal void MIDISetRunRate(short refnum, short rate, long time)
  297.  FOURWORDINLINE(0x203C, 0x0098, 4, 0xA800);
  298. extern pascal Handle MIDIGetClientIcon(OSType clientID)
  299.  FOURWORDINLINE(0x203C, 0x009C, 4, 0xA800);
  300. extern pascal long SndDispVersion(short toolnum)
  301.  FOURWORDINLINE(0x203C, 0x0000, 0x0000, 0xA800);
  302. #ifdef __cplusplus
  303. }
  304. #endif
  305.  
  306. #endif
  307.  
  308.